import { ref, onUnmounted } from "vue"

export default function (props, emit) {
  const offsetVal = ref(1069)
  const percent = ref(0) // 百分比
  const descrase = ref(5)
  const timer = setInterval(() => {
    offsetVal.value = _.range(offsetVal.value - descrase.value, 0)
    descrase.value = offsetVal.value / 200
    percent.value = _.range(_.round((1069 - offsetVal.value) / 1069 * 100, 0), 0 ,99)
  }, 20)
  onUnmounted(() => {
    clearInterval(timer)
  })
  return {
    offsetVal,percent,descrase,
    emit,
  }
}